import request from "@/utils/request";

export default {
  getByQuestionId(questionId) {
    return request({
      url: `/QuestionTranslated/getByQuestionId/${questionId}`,
      method: "get",
    });
  },

  edit(data) {
    const answer = data.answer;
    let arr = answer.sort();
    let str = "";
    for (let index = 0; index < arr.length; index++) {
      const element = arr[index];
      str += element;
      if (index < arr.length - 1) {
        str += "+";
      }
    }
    data.answer = str;
    return request({
      url: `/QuestionTranslated/edit`,
      method: "post",
      data,
    });
  },
};
